package cn.edu.dz;

public class Teacher {
    public String name;
    public int age;//protect也可；protect在包内和包外子类可以使用
    protected int height;//不同包下无法访问，
    public boolean sex;

    //构造方法
    public  Teacher(){};
    public void sayHi(){
        System.out.println("大家好，我叫"+ name+",我今年"+age+"岁"+"性别"+(sex?"男":"女"));
    }
    //方法重载
    public void sayHi(String name){
        System.out.println("大家好，我叫"+ name);
    }

   /* public String sayHi(String name){
        System.out.println("大家好，我叫"+ name);
       return name;//必须有返回值
        }
        */


    public Teacher(String name,int age,boolean sex) {
        //this指代的就是当前对象，谁在调用它，谁就是this
        this.name = name;
        this.age = age;
        this.sex = sex;
    }


}
